package com.feibiao.computer;

import java.util.Scanner;
import java.lang.Math;

public class Div implements TwoOperandCompute {
    private double result;
    @Override
    public double compute() {
        double operand1,operand2;
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入被除数");
        operand1 = scanner.nextDouble();
        System.out.println("请输入除数");
        operand2 = scanner.nextDouble();
        if (Math.abs(operand2) > 0){
            result = operand1 / operand2;
        }else {
            System.out.println("输入有误，除数不能为0");
        }
       return result;
    }
}
